<template>
	<view class="" style="width: 100vw;height: 100vh">
	<!-- <view 
	style="min-height: 100vh">
		<image class="bg" src="/static/login/log_bg.png" mode="scaleToFill"></image> -->
	<view class="content" :style="{'background':kbackgroundColor}" style="min-height: 100vh">
	
		<hx-navbar title="兑换记录" :back="true" :fixed="false" :color="knavTitleColor" barPlaceholder="hidden" transparent="auto"></hx-navbar>
		<view class="wrapper">
			<view class="list">
				<template v-for="(item, index) in list">
					<view class="item" :key="index">
						<view class="cover">
							<image :src="item.image" mode="aspectFill"></image>
						</view>
						<view class="info">
							<view class="title">兑换{{item.goods_name}}</view>
							<view class="num">订单编号:{{item.sn}}</view>
							<view class="time">{{item.ctime}}</view>
						</view>
					</view>
				</template>
			</view>
			<view  style="text-align: center;" v-if="list.length===0">
				 <image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix"></image> 
				 </view>
		</view>
	</view>
</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 16,
				last: false
			};
		},
		onLoad() {
			this.getPointExChangeList();
		},
		onPullDownRefresh() {
			this.page = 1;
			this.getPointExChangeList();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 300);
		},
		onReachBottom() {
			if (!this.last) {
				this.page++;
				this.getPointExChangeList();
			}
		},
		methods: {
			// 列表
			getPointExChangeList() {
				this.$api.getPointExChangeList({
					page: this.page,
					limit: this.limit
				}, res => {
					if (res.status) {
						if (res.data.list.length == 0) return this.last = true;
						if (this.page == 1) {
							this.list = res.data.list;
						} else {
							this.lsit = [...this.list, ...res.data.list];
						}
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.wrapper {
		padding: 20rpx 30rpx 50rpx;
		position: relative;
		z-index: 2;
		.list {
			width: 100%;
			.item {
				width: 100%;
				padding: 12rpx 18rpx;
				background-color: #fff;
				border-radius: 10rpx;
				margin-bottom: 20rpx;
				display: flex;
				align-items: center;
				.cover {
					width: 142rpx;
					height: 142rpx;
					margin-right: 14rpx;
					image {
						width: 100%;
						height: 100%;
						display: block;
						border-radius: 10rpx;
					}
				}
				.info {
					width: 480rpx;
					.title {
						font-size: 28rpx;
						color: #333;
						font-weight: bold;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
					.num, .time {
						font-size: 22rpx;
						color: #999;
						margin: 6rpx 0;
					}
					.time {
						margin: 0;
					}
				}
			}
			& > view:last-child {
				margin-bottom: 0;
			}
		}
	}
</style>